using IGG.POCO;
using System;
using System.Collections.Generic;
using System.Text;

namespace IGGCore
{
    public class Scoreboard
    {
        private DateTime m_date;
        private DateTime m_lastUpdate;
        private GameList m_gamesList = new GameList();
        private Game m_selectedGame = null;

        public Team ActiveTeam { get; set; }

        private Dictionary<Indicator.IndicatorCategoy, GameList> m_modeLists
            = new Dictionary<Indicator.IndicatorCategoy, GameList>();
        
        private List<News> m_news = new List<News>();
        private string[] m_history = new string[3];
        private List<StandingTeam> m_standingsNLE = new List<StandingTeam>();
        private List<StandingTeam> m_standingsNLC = new List<StandingTeam>();
        private List<StandingTeam> m_standingsNLW = new List<StandingTeam>();
        private List<StandingTeam> m_standingsNLWC = new List<StandingTeam>();
        private List<StandingTeam> m_standingsALE = new List<StandingTeam>();
        private List<StandingTeam> m_standingsALC = new List<StandingTeam>();
        private List<StandingTeam> m_standingsALW = new List<StandingTeam>();
        private List<StandingTeam> m_standingsALWC = new List<StandingTeam>();

        private List<StandingTeam> m_standingsCactus = new List<StandingTeam>();
        private List<StandingTeam> m_standingsGrapefruit = new List<StandingTeam>();

        List<Dictionary<string, object>> m_statsBatting = new List<Dictionary<string, object>>();
        List<Dictionary<string, object>> m_statsPitching = new List<Dictionary<string, object>>();
        List<Dictionary<string, object>> m_statsFielding = new List<Dictionary<string, object>>();

        private List<StatItem> m_statsNLBatting = new List<StatItem>();
        private List<StatItem> m_statsALBatting = new List<StatItem>();
        private List<StatItem> m_statsNLPitching = new List<StatItem>();
        private List<StatItem> m_statsALPitching = new List<StatItem>();
        private List<StatItem> m_statsNLFielding = new List<StatItem>();
        private List<StatItem> m_statsALFielding = new List<StatItem>();

        public string BaseballRefTidbit
        {
            get;
            set;
        }

        public List<Dictionary<string, object>> StatsBatting
        {
            get { return m_statsBatting; }
            set { m_statsBatting = value; }
        }
        public List<Dictionary<string, object>> StatsPitching
        {
            get { return m_statsPitching; }
            set { m_statsPitching = value; }
        }
        public List<Dictionary<string, object>> StatsFielding
        {
            get { return m_statsFielding; }
            set { m_statsFielding = value; }
        }


        public List<StatItem> StatsNLBatting
        {
            get { return m_statsNLBatting; }
            set { m_statsNLBatting = value; }
        }
        public List<StatItem> StatsALBatting
        {
            get { return m_statsALBatting; }
            set { m_statsALBatting = value; }
        }
        public List<StatItem> StatsNLPitching
        {
            get { return m_statsNLPitching; }
            set { m_statsNLPitching = value; }
        }
        public List<StatItem> StatsALPitching
        {
            get { return m_statsALPitching; }
            set { m_statsALPitching = value; }
        }
        public List<StatItem> StatsNLFielding
        {
            get { return m_statsNLFielding; }
            set { m_statsNLFielding = value; }
        }
        public List<StatItem> StatsALFielding
        {
            get { return m_statsALFielding; }
            set { m_statsALFielding = value; }
        }

        public List<StatItem> CommonStats { get; set; }

        public Scoreboard()
        {
            foreach (Indicator.IndicatorCategoy item in Enum.GetValues(typeof(Indicator.IndicatorCategoy))) 
            {
                m_modeLists.Add(item, new GameList());
            }
        }

        public List<News> News
        {
            get { return m_news; }
            set { m_news = value; }
        }

        public Tweet[] Tweets{get;set;}

        public List<TransactionDay> Transactions { get; set; }

        public List<StandingTeam> StandingsCactus
        {
            get { return m_standingsCactus; }
            set { m_standingsCactus = value; }
        }
        public List<StandingTeam> StandingsGrapefruit
        {
            get { return m_standingsGrapefruit; }
            set { m_standingsGrapefruit = value; }
        }

        public List<StandingTeam> StandingsNLE
        {
            get { return m_standingsNLE; }
            set { m_standingsNLE = value; }
        }
        public List<StandingTeam> StandingsNLC
        {
            get { return m_standingsNLC; }
            set { m_standingsNLC = value; }
        }
        public List<StandingTeam> StandingsNLW
        {
            get { return m_standingsNLW; }
            set { m_standingsNLW = value; }
        }
        public List<StandingTeam> StandingsNLWC
        {
            get { return m_standingsNLWC; }
            set { m_standingsNLWC = value; }
        }

        public List<StandingTeam> StandingsALE
        {
            get { return m_standingsALE; }
            set { m_standingsALE = value; }
        }
        public List<StandingTeam> StandingsALC
        {
            get { return m_standingsALC; }
            set { m_standingsALC = value; }
        }
        public List<StandingTeam> StandingsALW
        {
            get { return m_standingsALW; }
            set { m_standingsALW = value; }
        }
        public List<StandingTeam> StandingsALWC
        {
            get { return m_standingsALWC; }
            set { m_standingsALWC = value; }
        }

        public void Reset()
        {
            GamesList.ClearList();
            foreach (GameList list in ModeGameList.Values)
            {
                list.ClearList();
            }
        }

        public Game SelectedGame
        {
            get { return m_selectedGame; }
            set { m_selectedGame = value; }
        }

        public string[] History
        {
            get { return m_history; }
            set { m_history = value; }
        }

        public DateTime Date
        {
            get { return m_date; }
            set { m_date = value; }
        }

        public DateTime LastUpdate
        {
            get { return m_lastUpdate; }
            set { m_lastUpdate = value; }
        }

        public GameList GamesList
        {
            get { return m_gamesList; }
            set { m_gamesList = value; }
        }

        public Dictionary<Indicator.IndicatorCategoy, GameList> ModeGameList
        {
            get
            {
                return m_modeLists;
            }
        }
    }
}
